/*
 * Copyright (C) 2018 wxyz <hyhjwzx@126.com>
 * This program can be distributed under the terms of the GNU GPL Version 2.
 * See the file LICENSE.
 *
 */

package ren.wxyz.study.euler.hp01;

import ren.wxyz.study.euler.base.IProblem;
import ren.wxyz.study.euler.util.ConsoleHelper;

/**
 * 第 9 题
 *
 * @auther wxyz 2018-03-08_21:48
 * @since 1.0
 */
public class P009 implements IProblem {
    @Override
    public void main(String[] args) throws Throwable {

        long product = 0;
        int a = 0;
        int b = 0;
        int c = 0;
        for (int i = 1; i < 1000; i++) {
            for (int j = 1; j < 1000; j++) {
                a = i;
                b = j;
                c = 1000 - a - b;
                if (c * c == (a * a + b * b)) {
                    product = a * b * c;
                    break;
                }
            }
            if (product != 0) {
                break;
            }
        }

        ConsoleHelper.printf("三元组的乘积是 %1$d = %2$d * %3$d * %4$d", product, a, b, c);
        ConsoleHelper.print();
    }
}
